var Script = function () {

    h('#pills').bootstrapWizard({'tabClass': 'nav nav-pills', 'debug': false, onShow: function(tab, navigation, index) {
        console.log('onShow');
    }, onNext: function(tab, navigation, index) {
        console.log('onNext');
    }, onPrevious: function(tab, navigation, index) {
        console.log('onPrevious');
    }, onLast: function(tab, navigation, index) {
        console.log('onLast');
    }, onTabClick: function(tab, navigation, index) {
        console.log('onTabClick');
        alert('on tab click disabled');
    }, onTabShow: function(tab, navigation, index) {
        console.log('onTabShow');
        var htotal = navigation.find('li').length;
        var hcurrent = index+1;
        var hpercent = (hcurrent/htotal) * 100;
        h('#pills').find('.bar').css({width:hpercent+'%'});
    }});

    h('#tabsleft').bootstrapWizard({'tabClass': 'nav nav-tabs', 'debug': false, onShow: function(tab, navigation, index) {
        console.log('onShow');
    }, onNext: function(tab, navigation, index) {
        console.log('onNext');
    }, onPrevious: function(tab, navigation, index) {
        console.log('onPrevious');
    }, onLast: function(tab, navigation, index) {
        console.log('onLast');
    }, onTabClick: function(tab, navigation, index) {
        console.log('onTabClick');

    }, onTabShow: function(tab, navigation, index) {
        console.log('onTabShow');
        var htotal = navigation.find('li').length;
        var hcurrent = index+1;
        var hpercent = (hcurrent/htotal) * 100;
        h('#tabsleft').find('.bar').css({width:hpercent+'%'});

        // If it's the last tab then hide the last button and show the finish instead
        if(hcurrent >= htotal) {
            h('#tabsleft').find('.pager .next').hide();
            h('#tabsleft').find('.pager .finish').show();
            h('#tabsleft').find('.pager .finish').removeClass('disabled');
        } else {
            h('#tabsleft').find('.pager .next').show();
            h('#tabsleft').find('.pager .finish').hide();
        }

    }});


    h('#tabsleft .finish').click(function() {
        alert('Finished!, Starting over!');
        h('#tabsleft').find("a[href*='tabsleft-tab1']").trigger('click');
    });

}();